package com.qf.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author sunyamei
 * @version V1.0
 * @Project javase2203
 * @Package com.qf.config
 * @Description:
 * @Date 2022/8/11 10:19
 *
 * 初始化类,初始化resttemplate用来发送http的对象中,支持rebbon负载均衡
 */
@Configuration
public class RestTemplateConfig {

    //相当于spring核心配置文件中的bean标签
    @Bean
    //ribbon中的负载均衡注解
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}